Create an @Injectable() class that receives Repository<Entity> via @InjectRepository() and wraps it with domain-specific query methods. Use composition over inheritance — inject and delegate rather than extending Repository directly to avoid breaking changes when TypeORM updates its internal API.
Composition over inheritance — inject Repository<T> and delegate rather than extending it.
Extending Repository directly creates tight coupling to TypeORM internals and breaks on major upgrades.
Domain-specific methods like findByEmail belong in the custom repository, not the service.
Register the custom repository class in the module's providers array alongside TypeOrmModule.forFeature().
Export the custom repository if other modules need to use it.